package com.fr.chart.axis;

import com.fr.base.background.Background;
import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.BaseXMLUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.DataSeriesCondition;
import com.fr.chart.base.equals.Equals;

public class SeriesAttrBackground
  implements DataSeriesCondition
{
  private static final long serialVersionUID = -2629309796122971477L;
  public static final String XML_TAG = "SeriesAttrBackground";
  private Background seriesBackground = null;

  public SeriesAttrBackground()
  {
  }

  public SeriesAttrBackground(Background paramBackground)
  {
    this.seriesBackground = paramBackground;
  }

  public void setSeriesBackground(Background paramBackground)
  {
    this.seriesBackground = paramBackground;
  }

  public Background getSeriesBackground()
  {
    return this.seriesBackground;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str = paramXMLableReader.getTagName();
      if (str.equals("Background"))
        setSeriesBackground(BaseXMLUtils.readBackground(paramXMLableReader));
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("SeriesAttrBackground");
    if (this.seriesBackground != null)
      BaseXMLUtils.writeBackground(paramXMLPrintWriter, this.seriesBackground);
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    SeriesAttrBackground localSeriesAttrBackground = (SeriesAttrBackground)super.clone();
    if (this.seriesBackground != null)
      localSeriesAttrBackground.seriesBackground = ((Background)this.seriesBackground.clone());
    return localSeriesAttrBackground;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof SeriesAttrBackground))
      return false;
    SeriesAttrBackground localSeriesAttrBackground = (SeriesAttrBackground)paramObject;
    return (Equals.equals(localSeriesAttrBackground.seriesBackground, this.seriesBackground));
  }

  public JSONObject toJSONObject()
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    if (this.seriesBackground != null)
    {
      localJSONObject.put("backgroundType", this.seriesBackground.getBackgroundType());
      localJSONObject.put("seriesBackground", this.seriesBackground.toJSONObject());
    }
    return localJSONObject;
  }

  public String getConditionType()
  {
    return "SeriesAttrBackground";
  }
}